﻿using System;

namespace diantou.web.ajax.enterprise
{
    /// <summary>
    /// 考试调用
    /// </summary>
    [fastCSharp.code.cSharp.ajax(IsPool = true)]
    class exam : examHandle<exam>
    {
        /// <summary>
        /// 添加考试
        /// </summary>
        /// <param name="value"></param>
        /// <param name="onReturn"></param>
        public void Append(diantou.examDataAccess.exam value, Action<fastCSharp.net.returnValue<int>> onReturn)
        {
            value.UserId = currentUser.Id;
            diantou.examDataAccess.tcpCall.exam.append(value, onReturn);
        }
        /// <summary>
        /// 修改考试
        /// </summary>
        /// <param name="value"></param>
        /// <param name="onReturn"></param>
        public void Rework(fastCSharp.emit.memberMapValue<diantou.dataModel.exam, diantou.examDataAccess.exam> value, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            diantou.examDataAccess.tcpCall.exam.rework(value, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 发布考试
        /// </summary>
        /// <param name="id"></param>
        /// <param name="onReturn"></param>
        public void ReworkStatus(int id, diantou.dataModel.exam.status status, Action<fastCSharp.net.returnValue<int>> onReturn)
        {
            diantou.examDataAccess.tcpCall.exam.reworkStatus(id, status, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 结束考试
        /// </summary>
        /// <param name="id"></param>
        /// <param name="onReturn"></param>
        public void SetEndTime(int id, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            diantou.examDataAccess.tcpCall.exam.setEndTime(id, currentUser.Id, onReturn);
        }
        ///// <summary>
        ///// 复制考试
        ///// </summary>
        ///// <param name="id"></param>
        ///// <param name="onReturn"></param>
        //public void Copy(int id, Action<fastCSharp.net.returnValue<int>> onReturn)
        //{
        //    diantou.examDataAccess.tcpCall.exam.copy(id, currentUser.Id, onReturn);
        //}

        /// <summary>
        /// 导入考试问题
        /// </summary>
        /// <param name="examId"></param>
        /// <param name="importId"></param>
        /// <param name="onReturn"></param>
        public void ImportExam(int examId, int importId, Action<fastCSharp.net.returnValue<int>> onReturn)
        {
            diantou.examDataAccess.tcpCall.examItem.import(examId, importId, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 自动生成考卷
        /// </summary>
        /// <param name="examId"></param>
        /// <param name="topicIds"></param>
        /// <param name="group"></param>
        /// <param name="onReturn"></param>
        public void SetAutoPaper(int examId, int[] topicIds, diantou.dataModel.examProblem.autoPaperGroup group, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            diantou.examDataAccess.tcpCall.examItem.setAutoPaper(examId, topicIds, group, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 清空考卷
        /// </summary>
        /// <param name="examId"></param>
        /// <param name="onReturn"></param>
        public void ClearPaper(int examId, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            diantou.examDataAccess.tcpCall.examItem.clearPaper(examId, currentUser.Id, onReturn);
        }
        
        ///// <summary>
        ///// 复制考试
        ///// </summary>
        ///// <param name="id"></param>
        ///// <param name="onReturn"></param>
        //public void Copy(int id, Action<fastCSharp.net.returnValue<int>> onReturn)
        //{
        //    diantou.examDataAccess.tcpCall.exam.copy(id, currentUser.Id, onReturn);
        //}

        /// <summary>
        /// 添加考试问题
        /// </summary>
        /// <param name="examId"></param>
        /// <param name="questionId"></param>
        /// <param name="onReturn"></param>
        public void AppendQuestion(int examId, int questionId, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            diantou.examDataAccess.tcpCall.examItem.appendQuestion(examId, questionId, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 删除考试问题
        /// </summary>
        /// <param name="examId"></param>
        /// <param name="questionId"></param>
        /// <param name="onReturn"></param>
        public void DeleteQuestion(int examId, int questionId, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            diantou.examDataAccess.tcpCall.examItem.removeQuestion(examId, questionId, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 添加考试问题
        /// </summary>
        /// <param name="examId"></param>
        /// <param name="questionId"></param>
        /// <param name="onReturn"></param>
        public diantou.dataModel.examQuestion GetAppendQuestion(int examId, int questionId, diantou.dataModel.examQuestion.type type)
        {
            if (diantou.examDataAccess.tcpCall.examItem.appendQuestion(examId, questionId, type, currentUser.Id))
            {
                return examDataAccess.clientCache.ExamQuestion[questionId];
            }
            return null;
        }
        /// <summary>
        /// 添加考试题目
        /// </summary>
        /// <param name="examId"></param>
        /// <param name="problemId"></param>
        /// <param name="onReturn"></param>
        public void AppendProblem(int examId, int problemId, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            diantou.examDataAccess.tcpCall.examItem.appendProblem(examId, problemId, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 删除考试题目
        /// </summary>
        /// <param name="examId"></param>
        /// <param name="problemId"></param>
        /// <param name="onReturn"></param>
        public void DeleteProblem(int examId, int problemId, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            diantou.examDataAccess.tcpCall.examItem.removeProblem(examId, problemId, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 添加考试题目
        /// </summary>
        /// <param name="examId"></param>
        /// <param name="problemId"></param>
        /// <param name="onReturn"></param>
        public diantou.examDataAccess.examProblem.sourceProblem GetAppendProblem(int examId, int problemId)
        {
            if (diantou.examDataAccess.tcpCall.examItem.getAppendProblem(examId, problemId, currentUser.Id))
            {
                return examDataAccess.clientCache.ExamProblem[problemId].SourceProblem;
            }
            return null;
        }
        /// <summary>
        /// 添加工作职位
        /// </summary>
        /// <param name="examId"></param>
        /// <param name="jobId"></param>
        /// <param name="onReturn"></param>
        public void AppendJob(int examId, int jobId, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            diantou.examDataAccess.tcpCall.examJob.append(examId, jobId, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 删除工作职位
        /// </summary>
        /// <param name="examIdjobIdparam>
        /// <param name="problemId"></param>
        /// <param name="onReturn"></param>
        public void DeleteJob(int examId, int jobId, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            diantou.examDataAccess.tcpCall.examJob.delete(examId, jobId, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 添加工作职位
        /// </summary>
        /// <param name="examId"></param>
        /// <param name="jobId"></param>
        /// <param name="onReturn"></param>
        public void GetAppendJob(int examId, int jobId, Action<fastCSharp.net.returnValue<diantou.dataModel.enterpriseJob>> onReturn)
        {
            diantou.examDataAccess.tcpCall.examJob.getAppend(examId, jobId, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 添加考试评审人员
        /// </summary>
        /// <param name="examId"></param>
        /// <param name="userId"></param>
        /// <param name="onReturn"></param>
        public void AppendReviewUser(int examId, int userId, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            diantou.examDataAccess.tcpCall.examReviewer.append(examId, userId, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 添加考试评审人员
        /// </summary>
        /// <param name="examId"></param>
        /// <param name="userId"></param>
        /// <param name="onReturn"></param>
        public void DeleteReviewUser(int examId, int userId, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            diantou.examDataAccess.tcpCall.examReviewer.delete(examId, userId, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 添加考试评审人员
        /// </summary>
        /// <param name="examId"></param>
        /// <param name="userId"></param>
        /// <param name="onReturn"></param>
        public void GetAppendReviewUser(int examId, int userId, Action<fastCSharp.net.returnValue<diantou.examDataAccess.examReviewer.examReviewerName>> onReturn)
        {
            diantou.examDataAccess.tcpCall.examReviewer.getAppend(examId, userId, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 添加企业评审人员
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="onReturn"></param>
        public void AppendEnterpriseReviewUser(int userId, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            diantou.examDataAccess.tcpCall.examEnterpriseReviewer.append(userId, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 删除企业评审人员
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="onReturn"></param>
        public void DeleteEnterpriseReviewUser(int userId, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            diantou.examDataAccess.tcpCall.examEnterpriseReviewer.delete(userId, currentUser.Id, onReturn);
        }
    }
}
